def heapsort(bb):
  ''' unit test
  >>> heapsort([10, 9, 8, 11])
  [8, 9, 10, 11]
  '''  
  a = bb[:]
  r = []
  size = len(bb)
  for i in range(0, size):
    m = a[0]
    no = 0
    for j in range(1, size - i):      
       if m > a[j]:
          m = a[j]
          no = j
    a.pop(no)
    r.append(m)


  return r  
    
    
def bubblesort(bb):
  ''' unit test
  >>> bubblesort([10, 9, 8, 11])
  [8, 9, 10, 11]
  '''      
  a = bb[:]
  size = len(a)
  
  for i in range(size, 1, -1):
    for j in range(0, i-1):
       if a[j] > a[j+1]:
          b = a[j]
          a[j] = a[j+1]
          a[j+1] = b
  return a    
    
import doctest
doctest.testmod()    
    
  